﻿using AnesSystem.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace AnesSystem.Controls
{
    /// <summary>
    /// LeftMenuExpanderCtrl.xaml 的交互逻辑
    /// </summary>
    public partial class LeftMenuExpanderCtrl : UserControl
    {

        #region Variables

        private List<ToggleButton> _menuItemList=new List<ToggleButton>();

        #endregion

        #region Constructor

        public LeftMenuExpanderCtrl()
        {
            InitializeComponent();
        }

        #endregion

        #region Properties

        public Orientation DisplayDirection
        {
            get
            {
                return _wrap.Orientation;
            }
            set
            {
                _wrap.Orientation = value;
            }
        }

        public List<ToggleButton> MenuItemList
        {
            get
            {
                return _menuItemList;
            }
            set
            {
                _menuItemList = value;
            }
        }


        public IEnumerable<MenuListModel> ItemSource
        {
            set
            {
                _menuItemList.Clear();
                _wrap.Children.Clear();
                foreach (var parent in value)
                {
                    ToggleButton toggleBtn = new ToggleButton();
                    toggleBtn.Content = parent.Name;
                    toggleBtn.DataContext = parent;
                    _menuItemList.Add(toggleBtn);
                    _wrap.Children.Add(toggleBtn);
                }
            }
        }

        public object Header
        {
            get
            {
                return _expander.Header;
            }
            set
            {
                _expander.Header = value;
            }
        }

        #endregion

        #region Event

        public event EventHandler<MenuClickArgs> MenuClicked;

        #endregion

        #region Private Methods

        #endregion

        #region Public/Protected Methods

        #endregion

        #region EventHandlers

        #endregion

    }
}
